// createRouter 可执行的函数 产出一个router路由实例对象
import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/views/Layout'
import Home from '@/views/Home'
import Category from '@/views/Category'
import Play from '@/views/Playground'
import SubCategory from '@/views/Category/sub/index.vue'
import Goods from '@/views/Goods/index'
const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/',
        component: Home
      },
      {
        path: '/category/:id',
        component: Category
      },
      {
        path: '/category/sub/:id',
        component: SubCategory
      },
      {
        path: '/goods/:id',
        component: Goods
      }
    ]
  },
  {
    path: '/play',
    component: Play
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
